Skip to content

feat(cdn) - Feature parity - #1601

Open
matheuspolitano wants to merge 8 commits into
stackitcloud:mainfrom
matheuspolitano:mp/cdn/feature-parity
Open

feat(cdn) - Feature parity#1601
matheuspolitano wants to merge 8 commits into
stackitcloud:mainfrom
matheuspolitano:mp/cdn/feature-parity

Conversation

@matheuspolitano

@matheuspolitano matheuspolitano commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description

(https://jira.schwarz/browse/STACKITCDN-1451)

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Acceptance tests got implemented or updated (see e.g. here)
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@matheuspolitano
matheuspolitano requested a review from a team as a code owner July 21, 2026 13:48
@cgoetz-inovex

Copy link
Copy Markdown
Contributor

Hi @matheuspolitano,
thanks for your contribution, I've created an internal issue to review and test this PR.

@github-actions

Copy link
Copy Markdown

This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it.

@github-actions github-actions Bot added the Stale PR is marked as stale due to inactivity. label Jul 30, 2026
@rubenhoenle rubenhoenle removed the Stale PR is marked as stale due to inactivity. label Jul 30, 2026
"backend": backend,
"regions": regionsFixture,
"blocked_countries": blockedCountriesFixture,
"blocked_ips": types.ListValueMust(types.StringType, []attr.Value{}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some tests where the values are not null

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

cdnSdk "github.com/stackitcloud/stackit-sdk-go/services/cdn/v1api"
)

func createTestConfig(vals map[string]attr.Value) types.Object {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests here as well to test the values. The createTestConfig is kind of special. Maybe you could use a fixture config like in other tests instead of this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its done

Computed: true, // Required when using Default
Description: schemaDescriptions["config_blocked_ips"],
ElementType: types.StringType,
Default: listdefault.StaticValue(types.ListValueMust(types.StringType, []attr.Value{})),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try to avoid using defaults because then the value gets actively set by Terraform, and you cannot use a server-side default or change this later. Feel free to reach out to me if you have further questions regarding this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't define a schema Default, Terraform plans the omitted attribute as null. But when the API returns [], mapFields writes [] into the state. Because null (plan) does not match [] (state), Terraform throws the "Provider produced inconsistent result after apply" error. Adding Default: listdefault.StaticValue(...) forces the planned value to be [] in the plan before apply, making it match the returned state perfectly and preventing the error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this value will never change so is safe

},
"default_cache_duration": schema.StringAttribute{
Optional: true,
Computed: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this value changed by the service?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

},
"monthly_limit_bytes": schema.Int64Attribute{
Optional: true,
Computed: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this value changed by the service?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

if !utils.IsUndefined(configModel.StripResponseCookies) {
configPatch.StripResponseCookies = configModel.StripResponseCookies.ValueBoolPointer()
}
if !utils.IsUndefined(configModel.DefaultCacheDuration) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that there is a toCreatePayload but no toUpdatePayload function 🤔 If you like, you could introduce that, but it's not a must-have because it was already that way. But would be much cleaner and better testable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a plan to refactor in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants